import { defineConfig } from "vitepress";
import { whyframe } from "@whyframe/core";
import { whyframeVue } from "@whyframe/vue";
import { navRoutes, sidebarRoutes } from "../router/index.ts";

// https://vitepress.dev/reference/site-config
export default defineConfig({
  markdown: {
    // 可以通过以下配置为每个代码块启用行号
    lineNumbers: true
  },
  // iframe配置
  vite: {
    plugins: [
      // iframe配置
      // Initialize core plugin
      whyframe({
        defaultSrc: "/frames/default", // provide our own html
      }),

      // Initialize Vue integration plugin
      whyframeVue({
        include: /\.(?:vue|md)$/, // also scan in markdown files
      }),
    ],
  },
  base: "/vitepress/",
  title: "baiyetongUI",
  description: "封装uniapp三端常用组件",
  head: [
    [
      "link",
      {
        rel: "icon",
        href: "https://img.yummall.cn/baiyetong/yunmaobms/static/images/login/24651689240531_.pic.png",
      },
    ],
  ],
  // 主题配置
  // 导航栏配置
  themeConfig: {
    logo: "https://img.yummall.cn/baiyetong/yunmaobms/static/images/login/24651689240531_.pic.png",
    // 头部nav
    //  @ts-ignore
    nav: navRoutes(),
    // 侧边栏配置
    //  @ts-ignore
    sidebar: sidebarRoutes(),
    // 文档卡片默认文字
    markdown: {
      image: {
        // 默认禁用图片懒加载
        // 打开图片懒加载
        lazyLoading: true,
      },
      container: {
        tipLabel: "提示",
        warningLabel: "警告",
        dangerLabel: "危险",
        infoLabel: "信息",
        detailsLabel: "详细信息",
      },
    },
    // 上一页下一页标题
    docFooter: {
      prev: "上一页",
      next: "下一页",
    },
    // 全局大纲
    outline: {
      label: "页面导航",
    },
    // 开启搜索
    search: {
      provider: "local",
      options: {
        locales: {
          root: {
            placeholder: "搜索文档",
            translations: {
              button: {
                buttonText: "搜索文档",
                buttonAriaLabel: "搜索文档",
              },
              modal: {
                noResultsText: "无法找到相关结果",
                resetButtonTitle: "清除查询条件",
                // @ts-ignore
                searchBox: {
                  resetButtonTitle: "清除查询条件",
                  resetButtonAriaLabel: "清除查询条件",
                  cancelButtonText: "取消",
                  cancelButtonAriaLabel: "取消",
                },
                startScreen: {
                  recentSearchesTitle: "搜索历史",
                  noRecentSearchesText: "没有搜索历史",
                  saveRecentSearchButtonTitle: "保存至搜索历史",
                  removeRecentSearchButtonTitle: "从搜索历史中移除",
                  favoriteSearchesTitle: "收藏",
                  removeFavoriteSearchButtonTitle: "从收藏中移除",
                },
                errorScreen: {
                  titleText: "无法获取结果",
                  helpText: "你可能需要检查你的网络连接",
                },
                footer: {
                  selectText: "选择",
                  navigateText: "切换",
                  closeText: "关闭",
                },
                noResultsScreen: {
                  noResultsText: "无法找到相关结果",
                  suggestedQueryText: "你可以尝试查询",
                  reportMissingResultsText: "你认为该查询应该有结果？",
                  reportMissingResultsLinkText: "点击反馈",
                },
              },
            },
          },
        },
      },
    },
    // 最后更新时间
    // lastUpdated: {
    //   text: "最后更新时间",
    //   formatOptions: {
    //     dateStyle: "full",
    //     timeStyle: "medium",
    //   },
    // },
    // 底部配置
    footer: {
      message: "百业通组件归红人网络所有",
      copyright: "这是百业通uniapp组件2024第一版",
    },
  },
});
